package com.ljx.controller;

import com.ljx.aop.annotation.SystemLog;
import com.ljx.common.ResponseResult;
import com.ljx.domain.entity.User;
import com.ljx.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 李捷禧
 * Date: 2023/4/20
 * ClassName: UserController
 */

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/userInfo")
    public ResponseResult getUser(){
        return userService.getUser();
    }

    @PutMapping("/userInfo")
    @SystemLog(businessName = "更新用户信息")
    public ResponseResult updateUser(@RequestBody User user){
        return userService.updateUser(user);
    }

    @PostMapping("/register")
    public ResponseResult register(@RequestBody User user){
        return userService.register(user);
    }

}
